<?php
class TosutjAction extends Action
{
	//提取提交信息
    public function tj()
	{
     header('Access-Control-Allow-Origin:*');
        //die(P($id));




        //参数过滤
        $requestArr = $_POST;

        if ($requestArr==null){
            $this->bcode('0','你的填写有问题');
        }

        //请求地址
        $requestArrs['ly_url'] = $_POST['url'];
        //请求IP
        $requestArrs['ly_ip'] = $_SERVER['REMOTE_ADDR'];
        if (common_is_ip( $requestArrs['ly_ip'])==null){
            $this->bcode('0','你的当前网络有问题请更换网络');
        }
        if ($requestArr['T_Q12']==null){
            $this->bcode('0','病人科室没有填写');
        }else if ($requestArr['T_Q13']==null){
            $this->bcode('0','病人姓名没有填写');
        }else if (common_is_realnames($requestArr['T_Q13'])==null){
            $this->bcode('0','病人姓名填写错误');
        }else if (common_is_number($requestArr['T_Q14'],1,2)==null){
            $this->bcode('0','病人年龄填写错误');
        }else if (common_is_mobile($requestArr['T_Q21'])==null){
            $this->bcode('0','手机号码填写错误');
        }

        //数据转换
        $requestArrs['tq1']=$requestArr['T_Q1'];
        $requestArrs['tq2']=$requestArr['T_Q2'];
        $requestArrs['tq3']=$requestArr['T_Q3'];
        $requestArrs['tq4']=$requestArr['T_Q4'];
        $requestArrs['tq5']=$requestArr['T_Q5'];
        $requestArrs['tq6']=$requestArr['T_Q6'];
        $requestArrs['tq7']=$requestArr['T_Q7'];
        $requestArrs['tq8']=$requestArr['T_Q8'];
        $requestArrs['tq9']=$requestArr['T_Q9'];
        $requestArrs['tq10']=$requestArr['T_Q10'];
        $requestArrs['tq11']=$requestArr['T_Q11'];
        $requestArrs['tq12']=$requestArr['T_Q12'];
        $requestArrs['tq13']=$requestArr['T_Q13'];
        $requestArrs['tq14']=$requestArr['T_Q14'];
        $requestArrs['tq15']=$requestArr['T_Q15'];
        $requestArrs['tq16']=$requestArr['T_Q16'];
        $requestArrs['tq17']=$requestArr['T_Q17'];
        $requestArrs['tq18']=$requestArr['T_Q18'];
        $requestArrs['tq19']=$requestArr['T_Q19'];
        $requestArrs['tq20']=$requestArr['T_Q20'];
        $requestArrs['tq21']=$requestArr['T_Q21'];



        $tj = new TosutjModel();
        $result = $tj->tijiao($requestArrs);
        if ($result> 0){
            $this->bcode('1','已经成功提交');
        }else{
            $this->bcode('0','500,目前服务器繁忙提交失败');
        }

    P($_POST);

	}

    public function bcode($code='0',$data=''){
        //报错0为报错1为成功
        // $code = array('code'=>'0','data'=>'你的为资料错误');

        $code = array('code'=>$code,'data'=>$data,'tiem'=>date('Y-m-d H:i:s'));
        die(json_encode($code));
    }

}
?>